var http = require('http');
var url = require('url')
var fs = require('fs')


http.createServer(function(req,res){
	// console.log(req.url)
	var path = req.url
	function render(name){
		var content = fs.readFileSync(name)
		res.writeHead(200,{'content-type':'text/html'});
		res.write(content);
		res.end()
	}
	switch(path){
		case '/index':
		render('index.html')
		console.log('首页')
		break;
		case '/login':
		render('login.html')
		console.log('登录')
		break;
		case '/list':
		render('list.html')
		console.log('列表')
		break;
	}
}).listen(8866)
console.log('test2')